<template>

	<view class="homeLayout pageBg">
		<!-- 自定义头部导航 -->
		<custum-nav></custum-nav>
		<!-- 轮播图 -->
		<view class="banner">
			<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
				:duration="duration">
				<swiper-item>
					<image src="/common/images/banner1.jpg" mode="aspectFill"></image>
				</swiper-item>
				<swiper-item>
					<image src="/common/images/banner2.jpg"></image>
				</swiper-item>
				<swiper-item>
					<image src="/common/images/banner3.jpg"></image>
				</swiper-item>

			</swiper>
		</view>
		<!-- notices -->
		<view class="notices">
			<view class="left" style="display: flex;align-items: center;font-size: 28rpx;font-weight: bold;">
				<uni-icons color="#19b98d" type="sound" size="28"></uni-icons>
				&nbsp;<span style="color:#19b98d;font-weight: bold;font-size: 28rpx">公告</span>
			</view>
			<view class="center">
				<swiper class="swiper" circular vertical :autoplay="autoplay" :interval="interval" :duration="duration">
					<swiper-item>
						<text>U盾简单家具打底裤快点快点看得到</text>
					</swiper-item>
					<swiper-item>
						<text>妈妈妈妈吗就觉得觉得市场监督局简简单单肯定</text>
					</swiper-item>
				</swiper>
			</view>
			<view class="right">
				<uni-icons type="right" size="20" color="gray"></uni-icons>
			</view>
		</view>
		<!-- 列表 -->
		<view class="select">
			<common-title>
				<template #left>
					每日推荐
				</template>
				<template #right>
					<view class="date">
						<uni-icons type="calendar" color="#28b389" size="30"></uni-icons>
						<view class="">
							<uni-dateformat :date="Date.now()" format="dd日"></uni-dateformat>
						</view>
					</view>
				</template>
			</common-title>
			<view class="content">
				<scroll-view scroll-x="true">
					<view class="box" v-for="item in 8">
						<image src="/common/images/preview_small.webp" mode="aspectFill"></image>
					</view>
				</scroll-view>
			</view>
		</view>
			<!-- theme -->
			<view class="theme">
				<common-title>
					<template #left>
						专题精选
					</template>
					<template #right>
						<view style="color: gray;">More+</view>
					</template>
				</common-title>
				<view class="content">
					<theme-item v-for="item in 8"></theme-item>
					<theme-item  :showMore="true"></theme-item>
				</view>
			</view>
	</view>
</template>

<script lang="ts" setup>
	import { ref } from "vue"
	const indicatorDots = ref(true)
	const autoplay = (true)
	const interval = ref(2000)
	const duration = ref(500)
	
</script>

<style lang="scss" scoped>
	@import "../../common/style/style-common.scss";

	.homeLayout {
		width: 750rpx;
		padding: 30rpx 0;

		.banner {
			swiper {
				width: 750rpx;
				height: 340rpx;

				&-item {
					width: 100%;
					height: 100%;
					padding: 0 25rpx;

					image {
						width: 100%;
						height: 100%;
						border-radius: 10rpx;
					}
				}
			}
		}

		.notices {
			display: flex;
			align-items: center;
			justify-content: space-between;
			width: 690rpx;
			height: 80rpx;
			border-radius: 30rpx;
			margin: 30rpx auto;
			padding: 0 30rpx;
			background: #f9f9f9;
			box-sizing: border-box;

			.center {
				swiper {
					width: 430rpx;
					height: 80rpx;
					padding: 10rpx 5rpx;

					swiper-item text {
						display: block;
						width: 430rpx;
						color: gray;
						line-height: 60rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}
				}


			}
		}

		.select {
			.date {
				display: flex;
				align-items: center;
				color: #28b389;
			}

			.content {
				width: 720rpx;
				margin-left: 30rpx;
				margin-top: 30rpx;

				scroll-view {
					white-space: nowrap;

					.box {
						width: 200rpx;
						height: 430rpx;
						margin-right: 15rpx;
						display: inline-block;

						image {
							width: 100%;
							height: 100%;
							border-radius: 10rpx;
						}
					}

					.box:last-child {
						margin-right: 30rpx;
					}
				}
			}
		}
		.theme{
			margin-top: 30rpx;
			.content{
				margin-top: 30rpx;
				padding: 0 30rpx;
				display: grid;
				gap:15px;
				grid-template-columns: repeat(3,1fr);
			}
		}
	}
</style>